#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#if defined _WIN32 || defined _WIN64 // Windows
#include <windows.h>
#else // Linux;MacOSX
#include <unistd.h>
#include <sys/time.h>
#endif
#include "../include/VCIClient.h"

#define DEF_PORT 6100

int loop = 1;

void sighandler(int sig)
{
	loop = 0;
}

int main(int argc, char * argv[])
{
	signal(SIGABRT, sighandler);
	signal(SIGINT, sighandler);
	signal(SIGTERM, sighandler);
	VCIClient * client = VCNewClient();
	if (client)
	{
		client->Connect("127.0.0.1", DEF_PORT);
		client->MicOn();

		while (loop)
		{
#if defined _WIN32 || defined _WIN64
			Sleep(100);
#else
			usleep(100000);
#endif
		}

		client->MicOff();
		client->Disconnect();
		VCDeleteClient(client);
	} else
	{
		printf("ERROR CREATE CLIENT\n");
	}
	return 0;
}

